
CMAKE_MINIMUM_REQUIRED(VERSION 3.13...3.20)

project(plugin_audiotrack_sink)

include_directories(
        ${TOP_DIR}/histreamer/engine
        ${TOP_DIR}/histreamer/engine/foundation
        ${TOP_DIR}/histreamer/engine/plugin
)

set(BUILD_PLUGIN_AUDIO_TRACK_SINK_SHARED ON)

if (BUILD_PLUGIN_AUDIO_TRACK_SINK_SHARED)
    add_library(plugin_audiotrack_sink SHARED ./audio_track_sink_plugin.cpp ./audio_track_proxy.cpp ${TOP_DIR}/histreamer/engine/plugin/common/plugin_buffer.cpp)
else()
    add_library(plugin_audiotrack_sink STATIC ./audio_track_sink_plugin.cpp ./audio_track_proxy.cpp ${TOP_DIR}/histreamer/engine/plugin/common/plugin_buffer.cpp)
endif()

add_dependencies(plugin_audiotrack_sink histreamer jni_helper)

find_library(
        LOG_LIB
        log
)

add_library(SDL2_LIB SHARED IMPORTED)
set_property(TARGET SDL2_LIB PROPERTY IMPORTED_LOCATION ${sdl_lib_path}/libSDL2.so)

target_link_libraries(
        plugin_audiotrack_sink
        ${LOG_LIB}
        ${SDL2_LIB}
        histreamer
        jni_helper
)

message("------------------ BUILD plugin_audiotrack_sink ------------------")
install(TARGETS plugin_audiotrack_sink DESTINATION "${CMAKE_BINARY_DIR}/bin/plugins/")
